package com.nanhai.buddhist.college.module.study.dal.mysql.studyplan;

import java.util.*;

import com.nanhai.buddhist.college.framework.common.pojo.PageResult;
import com.nanhai.buddhist.college.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.nanhai.buddhist.college.framework.mybatis.core.mapper.BaseMapperX;
import com.nanhai.buddhist.college.module.study.dal.dataobject.studyplan.StudyPlanTeacherDO;
import org.apache.ibatis.annotations.Mapper;
import com.nanhai.buddhist.college.module.study.controller.admin.studyplan.vo.*;

/**
 * 教学计划教师信息 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface StudyPlanTeacherMapper extends BaseMapperX<StudyPlanTeacherDO> {

    default PageResult<StudyPlanTeacherDO> selectPage(StudyPlanTeacherPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StudyPlanTeacherDO>()
                .eqIfPresent(StudyPlanTeacherDO::getStudyPlanId, reqVO.getStudyPlanId())
                .eqIfPresent(StudyPlanTeacherDO::getTeacherId, reqVO.getTeacherId())
                .betweenIfPresent(StudyPlanTeacherDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(StudyPlanTeacherDO::getCreateTime));
    }

    default List<StudyPlanTeacherDO> selectList(StudyPlanTeacherExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<StudyPlanTeacherDO>()
                .eqIfPresent(StudyPlanTeacherDO::getStudyPlanId, reqVO.getStudyPlanId())
                .eqIfPresent(StudyPlanTeacherDO::getTeacherId, reqVO.getTeacherId())
                .betweenIfPresent(StudyPlanTeacherDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(StudyPlanTeacherDO::getCreateTime));
    }

    default Integer deleteByStudyPlanId(String id) {
        return delete(new LambdaQueryWrapperX<StudyPlanTeacherDO>().eq(StudyPlanTeacherDO::getStudyPlanId, id));
    }

}
